package org.test.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.test.vo.ShoppingCart;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    //添加购物车
    int addBookToShoppingCart(@Param("id")int id, @Param("bookid")int bookid, @Param("bookname")String bookname, @Param("booknum")int booknum);

    //根据用户编号和图书编号，查找购物车
    ShoppingCart selectShoppingByBook(@Param("id")int id, @Param("bookid")int bookid);

    //把购物车相关记录增加1
    int addBooknumToShoppingCart(@Param("cartid")int cartid,@Param("booknum")int booknum);

    //根据用户编号，查找所有购物车记录
    List<ShoppingCart> selectShoppingCartAll(@Param("id")int id);


   /* ShoppingCart selectShoppingCartAllBook(@Param("id")int id);*/

    //删除购物车
    void deleteShoppingCart(@Param("cartid")int cartid);
}
